﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CTEA_INDIA._Default"
    Theme="Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Src="~/Header.ascx" TagName="header" TagPrefix="uc" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Login</title>
    <script src="JS/Popup.js" type="text/javascript"></script>
    <link href="CSS/MyStyle.css" rel="stylesheet" type="text/css" />
    <link href="CSS/Stylsheet.css" rel="stylesheet" type="text/css" />
    <link href="CSS/Popup.css" rel="stylesheet" type="text/css" />
    <script src="JS/common.js" type="text/javascript"></script>
    <script src="JS/jquery-1.4.2.min.js" type="text/javascript"></script>
   <script type="text/javascript">
       function sendPassword() {
         
           var username = document.getElementById("txtuname").value;
           var type0 = document.getElementById("RtType1_0");
           var type1 = document.getElementById("RtType1_1");
         
           var type;
           if (type0.checked) {
               type = type0.value;
              
           } if (type1.checked) {
               type = type1.value;
           }

           if (username != "") {
               //if (validate(txtEmail)) {
               var xmlhttp;
               if (window.XMLHttpRequest) {
                   // code for IE7+, Firefox, Chrome, Opera, Safari
                   xmlhttp = new XMLHttpRequest();
               }
               else {// code for IE6, IE5
                   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

               }
               xmlhttp.onreadystatechange = function () {
                   if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                       document.getElementById("loading").style.display = "none";
                       document.getElementById("ErrorDiv").style.display = "block";
                       document.getElementById("ErrorDiv").innerHTML = xmlhttp.responseText;
                       document.getElementById("txtuname").value = "";
                       document.getElementById("type").value = "";
                   }
               }
               xmlhttp.open("POST", "AJAX1/SendPassword.aspx?username=" + username + "&type=" + type, true);
               xmlhttp.send();
               document.getElementById("loading").style.display = "block";


           }

           else {
               document.getElementById("div7").innerHTML = "Please Enter UserName";
               toggleDiv('div7', 1);
               return false;
           }
       }

       // }
       //             else {
       //                 document.getElementById("div7").innerHTML = "Please enter valid Email ID.";
       //                 toggleDiv('div7', 1);
       //                 return false;
       //             }
       // }


       function clearOnFocus() {
           document.getElementById("idSpanMsg").style.display = "none";
       }
</script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
    <div>
        <uc:header runat="server" ID="aa" />
    </div>
    <%-- <div class="toporagne">
        <img src="Images/top_orange-strip.jpg" />
    </div>--%>
    <div>
        <center>
            <table width="900px" border="0" >
                <tr>
                    <td align="center">
                        <table cellpadding="5" cellspacing="2" border="0" style="border-color: #042F54;margin-top:40px" width="430px"
                        class="MainDivLogin" >
                            <tr>
                                <td colspan="2" align ="left" >
                                    <asp:Label ID="Label1" runat="server" Text="Login" class="myaccount"></asp:Label>
                                    <div class="imgstrip">
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td align="center" colspan="2" height="10px">
                                    <span id="idSpanMsg" runat="server" class="spanErrorMsgs" style="display: none; color: Red">
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td align="center" class="Label" style="width: 100px; padding-left: 30px; height: 10px"
                                    valign="middle">
                                    User Name:
                                </td>
                                <td align="left">
                                    <asp:TextBox ID="txtUserName" runat="server" MaxLength="100" ToolTip="Enter User Name."></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="rfvUsername" runat="server" ControlToValidate="txtUserName"
                                        ErrorMessage="Please Enter User Name" Display="None"></asp:RequiredFieldValidator>
                                    <asp:ValidatorCalloutExtender ID="rfvUsername_ValidatorCalloutExtender" runat="server"
                                        Enabled="True" TargetControlID="rfvUsername">
                                    </asp:ValidatorCalloutExtender>
                                    <asp:RegularExpressionValidator ID="revUsername" runat="server" ControlToValidate="txtUserName"
                                        ErrorMessage="Invalid user Name" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                        Display="None"></asp:RegularExpressionValidator>
                                    <asp:ValidatorCalloutExtender ID="revUsername_ValidatorCalloutExtender" runat="server"
                                        Enabled="True" TargetControlID="revUsername">
                                    </asp:ValidatorCalloutExtender>
                                </td>
                            </tr>
                            <tr>
                                <td align="center" class="Label" style="width: 100px; padding-left: 30px" valign="middle">
                                    Password:
                                </td>
                                <td align="left">
                                    <asp:TextBox ID="txtPassword" runat="server" MaxLength="100" TextMode="Password"
                                        ToolTip="Enter password."></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="rfvPassword" runat="server" ControlToValidate="txtPassword"
                                        ErrorMessage="Please Enter Your Pasword" Display="None"></asp:RequiredFieldValidator>
                                    <asp:ValidatorCalloutExtender ID="rfvPassword_ValidatorCalloutExtender" runat="server"
                                        Enabled="True" TargetControlID="rfvPassword">
                                    </asp:ValidatorCalloutExtender>
                                    <asp:RegularExpressionValidator ID="revPassword" runat="server" ErrorMessage="Invalid Pasword"
                                        ControlToValidate="txtPassword" ValidationExpression="(?!^[0-9]*$)(?!^[a-z]*$)^([a-z0-9@\$]{8,20})$"
                                        Display="None"></asp:RegularExpressionValidator>
                                    <asp:ValidatorCalloutExtender ID="revPassword_ValidatorCalloutExtender" runat="server"
                                        Enabled="True" TargetControlID="revPassword">
                                    </asp:ValidatorCalloutExtender>
                                </td>
                            </tr>
                            <tr>
                                <td align="left" class="Label" style="width: 100px; padding-left: 30px" valign="middle">
                                    <asp:Label CssClass="Label" ID="Label2" runat="server" Text="Login As"></asp:Label>
                                </td>
                                <td>
                                    <asp:RadioButtonList ID="rbtLogin" runat="server" TextAlign="right " RepeatDirection="Horizontal"
                                        CssClass="Label ">
                                        <asp:ListItem Selected="True" Text="User" Value="0">
                                        </asp:ListItem>
                                        <asp:ListItem Text="Candidate" Value="1"></asp:ListItem>
                                    </asp:RadioButtonList>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" class="small-Link" style="padding-left: 2px" align="right">
                                    <a href="javascript:void(0)" onclick="popup('PassPopup','blanket','0');return false;">
                                        Forgot Password?</a>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" align="center" class="button">
                                    <asp:Button ID="btnSubmit" runat="server" CssClass="btnsubmit" Text="Submit" OnClick="btnSubmit_Click"
                                        CausesValidation="false" />
                                    <%--<asp:Button ID="btnReset" runat="server" Text="Reset"  onclick="btnReset_Click" />--%>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" class="Label" align="left">
                                    <strong>Register As</strong> &nbsp;<span><a href="Candidate_Registration.aspx">Candidate</a></span>
                                    &nbsp;<span>or</span>&nbsp;<span><a href="User_Registration.aspx">User</a></span>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </center>
    </div>
    <asp:TextBox ID="txtUser" runat="server" Visible="false"></asp:TextBox>
    <center>
        <div name="light" runat="server" id="blanket" style="display: none;" class="blanket">
        </div>
        <div id="PassPopup" style="display: none; background-color: White; padding: 2px"
            class="Popup">
            <table cellpadding="5px" border="0">
                <tr>
                    <td align="left" colspan="4" style="padding: 0">
                        <table style="height: 100%">
                            <tr>
                                <td width="480px" align="left">
                                    <span>Forgot Password</span>
                                </td>
                                <td width="20px" align="center">
                                </td>
                                <td width="5px">
                                </td>
                                <td width="10px" align="right" style="white-space: nowrap; background-color: White;"
                                    valign="middle">
                                    <a href="javascript:void(0)" onclick="$('#PassPopup').fadeOut('slow');$('#blanket').fadeOut('slow');document.getElementById('txtuname').value='';document.getElementById('ErrorDiv').style.display='none';toggleDiv('div7', 0);"
                                        runat="server" id="lnkClose" style="color: white; border: 0">
                                        <img alt="" src="Images/newsletter_close.PNG" width="10px" align="right" height="10px"
                                            style="border: 0" title="Close" />
                                    </a>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td style="color: Black; font-size: 12px" align="right">
                        Username :
                    </td>
                    <td align="left">
                        <span style="float: left; padding-right: 5px"></span>
                        <input type="text" id="txtuname" maxlength="100" onfocus="toggleDiv('div7', 0);"
                            style="width: 180px" />
                        <span style="float: left"></span>
                        <div id="div7" class="errorDiv" style="float: left; padding-right: 5px">
                        </div>
                    </td>
                </tr>
                <tr>
                    <td style="color: Black; font-size: 12px" align="right">
                        Login as
                    </td>
                    <td style="color: Black; font-size: 12px; text-align: left" align="right">
                        <asp:RadioButtonList ID="RtType1" runat="server" RepeatDirection="Horizontal" Width="100%"
                            TextAlign="Right">
                            <asp:ListItem Value="0" Selected="True" Text="User"></asp:ListItem>
                            <asp:ListItem Value="1" Text="Candidate"></asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <div id="loading" style="display: none;">
                            <img src="Images/loading.gif" />Please wait...</div>
                    </td>
                </tr>
                <tr>
                    <td align="center" colspan="2">
                        <input type="button" id="Button1" value="SUBMIT" onclick="sendPassword();" class="btnsubmit" />
                    </td>
                </tr>
                <tr>
                    <td align="left" colspan="2" width="100%">
                        <div id="ErrorDiv" class="validatorerrorDiv" style="display: none; width: 380px;">
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </center>
    </form>
</body>
</html>
